package com.test.jbpm.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.test.jbpm.Pager;
import com.test.jbpm.dao.StudentDao;
import com.test.jbpm.dao.UserDao;
import com.test.jbpm.domain.Student;
import com.test.jbpm.domain.User;
import com.test.jbpm.service.StudentService;



@Service
public class StudentServiceImpl implements StudentService {

	private UserDao userDao;
	private StudentDao studentDao;
	@Autowired
	public void setStudentDao(StudentDao studentDao) {
		this.studentDao = studentDao;
	}

	
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	public void addOrUpdate(Student student) {
		studentDao.addOrUpdate(student);
	}

	public void del(Integer studentId) {
		studentDao.del(studentId);
	}

	public Student findStudentById(Integer studentId) {
		return studentDao.findStudentById(studentId);
	}

	public Pager<Student> findStudentList() {
		return studentDao.findStudentList();
	}

	public void del(Integer[] studentIds) {
		for (Integer studentId : studentIds) {
			studentDao.del(studentId);
		}
	}

	public User login(String userCode, String password) {
		return userDao.login(userCode, password);
	}

}
